<html>
<head><meta charset="utf-8"><title>Rustfmt · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Rustfmt.html">Rustfmt</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="222951481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Rustfmt/near/222951481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> CraftSpider <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Rustfmt.html#222951481">(Jan 16 2021 at 02:03)</a>:</h4>
<p>When I run <code>tidy</code> it asserts whether things are formatted, but what's the best way to actually do auto-formatting for your changes?</p>



<a name="222952685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Rustfmt/near/222952685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Rustfmt.html#222952685">(Jan 16 2021 at 02:26)</a>:</h4>
<p><code>./x.py fmt</code></p>



<a name="222952698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Rustfmt/near/222952698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Rustfmt.html#222952698">(Jan 16 2021 at 02:27)</a>:</h4>
<p>tidy just runs the equivalent of <code>./x.py fmt --check</code></p>



<a name="222952782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Rustfmt/near/222952782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Rustfmt.html#222952782">(Jan 16 2021 at 02:28)</a>:</h4>
<p>You can also configure your editor to run rustfmt, probably, on save - you'll want to use the same version of rustfmt as used in-tree though, which is pinned to a particular nightly usually (see src/stage0.txt for which one). It will be at ./build/$target/stage0/bin/rustfmt, too, after running x.py.</p>



<a name="222953004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Rustfmt/near/222953004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Rustfmt.html#222953004">(Jan 16 2021 at 02:32)</a>:</h4>
<p>I find that annoying though, because x.py fmt takes a while to run</p>



<a name="222953042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Rustfmt/near/222953042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Rustfmt.html#222953042">(Jan 16 2021 at 02:33)</a>:</h4>
<p>I know <code>./x.py fmt std</code> works, not sure about individual compiler crates though</p>



<a name="222953151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Rustfmt/near/222953151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Rustfmt.html#222953151">(Jan 16 2021 at 02:35)</a>:</h4>
<p>it's still not <em>fast</em></p>



<a name="222953451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Rustfmt/near/222953451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Rustfmt.html#222953451">(Jan 16 2021 at 02:40)</a>:</h4>
<p>x.py fmt for me takes ~5 seconds, but it is pretty slow.</p>



<a name="222953458"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Rustfmt/near/222953458" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Rustfmt.html#222953458">(Jan 16 2021 at 02:40)</a>:</h4>
<p>(On the other hand, we do have a lot of code).</p>



<a name="222954724"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Rustfmt/near/222954724" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> CraftSpider <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Rustfmt.html#222954724">(Jan 16 2021 at 03:04)</a>:</h4>
<p>Cool, I'll probably make it a run config, not an on-save, but that's the command I needed. Thanks</p>



<a name="223003174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Rustfmt/near/223003174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Rustfmt.html#223003174">(Jan 16 2021 at 20:11)</a>:</h4>
<p><code>x.py fmt</code> takes 20 seconds for me <span aria-label="cry" class="emoji emoji-1f622" role="img" title="cry">:cry:</span></p>
<p>I feel like it got slower at some point in the last couple months <span aria-label="shrug" class="emoji emoji-1f937" role="img" title="shrug">:shrug:</span> <br>
Maybe a lot of code was added.</p>



<a name="223008478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Rustfmt/near/223008478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Rustfmt.html#223008478">(Jan 16 2021 at 21:53)</a>:</h4>
<p>it also started checking macros, that might have slowed it down</p>



<a name="223018269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Rustfmt/near/223018269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Rustfmt.html#223018269">(Jan 17 2021 at 01:54)</a>:</h4>
<p>Hmm, when did that happen?</p>



<a name="223146222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Rustfmt/near/223146222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Rustfmt.html#223146222">(Jan 18 2021 at 17:20)</a>:</h4>
<p>Does x.py fmt use parallelism?</p>



<a name="223146532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Rustfmt/near/223146532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Rustfmt.html#223146532">(Jan 18 2021 at 17:23)</a>:</h4>
<p>I think so: <a href="https://github.com/rust-lang/rust/blob/66eb9821666e0672a69a998d2331733c7a8996a5/src/bootstrap/format.rs#L110">https://github.com/rust-lang/rust/blob/66eb9821666e0672a69a998d2331733c7a8996a5/src/bootstrap/format.rs#L110</a></p>



<a name="223148614"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Rustfmt/near/223148614" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Rustfmt.html#223148614">(Jan 18 2021 at 17:45)</a>:</h4>
<p>I think that's not a parallel runner but I could be wrong.</p>



<a name="223148991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Rustfmt/near/223148991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Rustfmt.html#223148991">(Jan 18 2021 at 17:49)</a>:</h4>
<p>Oh, it does call build parallel. Interesting.</p>



<a name="223149002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Rustfmt/near/223149002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Rustfmt.html#223149002">(Jan 18 2021 at 17:49)</a>:</h4>
<p>I wonder if it's actually a win.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>